package jcu.sal.common.agents.netty;

import static org.jboss.netty.channel.Channels.pipeline;

import org.jboss.netty.channel.ChannelPipeline;
import org.jboss.netty.channel.ChannelPipelineFactory;

/**
 * @author Marc Hammerton
 * 
 */
public class NettyClientPipelineFactory implements ChannelPipelineFactory {

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.jboss.netty.channel.ChannelPipelineFactory#getPipeline()
	 */
	@Override
	public ChannelPipeline getPipeline() throws Exception {
		ChannelPipeline pipeline = pipeline();
		
		// Add codecs
		pipeline.addLast("decoder", new NettyClientMessageDecoder());
		pipeline.addLast("encoder", new NettyClientMessageEncoder());
		
		pipeline.addLast("handler", new NettyClientHandler());
		
		return pipeline;
	}

}
